package com.zzk.www.tool.common;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.support.ApplicationObjectSupport;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * Created by zzk on 2017/12/21.
 */

@Component
public class BeanHolder {

    public static ApplicationContext context;

    public static<T> T get(Class<T> beanClass){
        return (T)context.getBean(beanClass);
    }

    public static<T> T get(Class<T> beanClass,String beanName){
        return (T)context.getBean(beanName);
    }



}
